package wwl.lsf.hellospringboot.forkjoin;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.ThreadLocalRandom;

/**
 * @Title
 * @Author wangwenliang
 * @Date 2020/9/23
 * @Description
 */
public class Stream {

    public static void main(String[] args) {

        long[] arrayOfLong = new long[20000];
        Arrays.parallelSetAll(arrayOfLong,
                index -> ThreadLocalRandom.current().nextInt(1000000));
        Arrays.stream(arrayOfLong).limit(10).forEach(
                i -> System.out.print(i + " "));
        System.out.println();
        Arrays.parallelSort(arrayOfLong);
        Arrays.stream(arrayOfLong).limit(10).forEach(
                i -> System.out.print(i + " "));
        System.out.println();

       /* ArrayList<Integer> integers = new ArrayList<>();
        integers.add(1);
        integers.add(2);
        integers.add(3);
        integers.add(4);

        integers.stream().forEach(integer -> {

            System.out.println(integer);

            return;
        });
        for (int i = 0; i < integers.size(); i++) {
            System.out.println(i + "wwl");
            return;
        }*/
    }


}
